#include <stdio.h>

/*汉诺塔*/
void movedisc(unsigned n,char romneedle,char toneedle,char usingneedle);

int i=0;
void main()
{
    unsigned n;
    printf("Plese enter the number of discs: ");
    scanf("%d",&n);
    printf("\tneedle:\ta\tb\tc\n");
    movedisc(n,'a','c','b');
    printf("\t Total: %d\n",i);
}

void movedisc(n,fromneedle,toneedle,usingneedle)

    unsigned n;
    char fromneedle,toneedle,usingneedle;
{
    if(n>0)
    {
        movedisc(n-1,fromneedle,toneedle,usingneedle);
        ++i;
        switch (fromneedle)
        {
            case 'a':switch(toneedle){
                case 'b':printf("\t[%d]:\t%2d.............>%2d\n",i,n,n);
                break;
                case 'c':printf("\t[%d]:\t%2d.............>%2d\n",i,n,n);
                break;
            }
            break;
            case 'b':switch(toneedle){
                case 'a':printf("\t[%d]:\t%2d<............%2d\n",i,n,n);
                break;
                case 'c':printf("\t[%d]:\t\t%2d.............>%2d\n",i,n,n);
                break;
            }
            break;
            case 'c':switch(toneedle){
                case 'a':printf("\t[%d]:\t%2d<.............%2d\n",i,n,n);
                break;
                case 'b':printf("\t[%d]:\t%2d<.............%2d\n",i,n,n);
                break;
            }
            break;




        }
        movedisc(n-1,usingneedle,toneedle,fromneedle);
    }
}